package com.geek.javase.ch02.test6;

/*
 *@author wangpeng
 *2025/10/10 20:05
 *@description TODO
 */
public class Goods {
    //属性
    private String  name;
    private double price;
    private String desc;
    private int count;
    //无参构造
    public Goods(){
    }
    //有参构造
    public Goods(String name, double price, String desc, int count) {
        this.name=name;
        this.price=price;
        this.desc=desc;
        this.count=count;
    }
    //getter方法

    public String getName() {
        return name;
    }

    public double getPrice() {
        return price;
    }

    public String getDesc() {
        return desc;
    }

    public int getCount() {
        return count;
    }
    //setter方法

    public void setName(String name) {
        this.name = name;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public void setCount(int count) {
        this.count = count;
    }
    public void showGoods(){
        System.out.println("商品名称："+name);
        System.out.println("商品价格："+price);
        System.out.println("商品描述："+desc);
        System.out.println("商品数量："+count);
    }
    public String toString() {
        return "Goods{name = " + name + ", price = " + price +", desc = " + desc + ", count = " + count +  "}";
    }
}
